package com.wocai.jrt.orgadmin.orders.service.spi;

import java.io.IOException;
import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.vteba.service.generic.MyBatisService;
import com.vteba.web.action.JsonBean;
import com.wocai.jrt.orgadmin.investor.bean.EmpBreifBean;
import com.wocai.jrt.orgadmin.issuers.bean.IssuersOrdersResBean;
import com.wocai.jrt.orgadmin.orders.bean.OfflineApplyResBean;
import com.wocai.jrt.orgadmin.orders.bean.OfflineOrderReqBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderDetailResBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderOfflineApplyResBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderPaySerialResBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderReqBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderResBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderStateResBean;
import com.wocai.jrt.orgadmin.orders.bean.OrderVisitResBean;
import com.wocai.jrt.orgadmin.orders.bean.ProductBreifBean;
import com.wocai.jrt.orgadmin.orders.model.Orders;
import com.wocai.jrt.orgadmin.orders.model.OrdersBean;
import com.wocai.jrt.orgadmin.stats.bean.GroupOdersReqBean;
import com.wocai.jrt.orgadmin.stats.bean.IndexStatsReqBean;
import com.wocai.jrt.orgadmin.stats.bean.ProductEmpStatsReqBean;
import com.wocai.jrt.orgadmin.stats.bean.ProductEmpStatsResBean;
import com.wocai.jrt.orgadmin.stats.bean.ProductRecruitProgressEleBean;

/**
 * 订单相关的业务service接口。
 * 
 * @author yinlei
 * @date 2015-8-4 19:44:34
 */
public interface OrdersService extends MyBatisService<Orders, OrdersBean, String> {
	/**
	 * 获得订单列表
	 * 
	 * @return
	 */
	public List<OrderResBean> getOrderResBeanList(OrderReqBean orderReqBean);

	/**
	 * @param orderReqBean
	 * @return 记录总数
	 */
	public long countByOrgId(OrderReqBean orderReqBean);

	/**
	 * 获取订单详情
	 * 
	 * @param orderId
	 * @return OrderDetialResBean
	 */
	public OrderDetailResBean getOrderDetial(OrderReqBean orderReqBean);

	/**
	 * 获取订单联系记录
	 * 
	 * @param orderId
	 * @return List<OrderVisitResBean>
	 */
	public List<OrderVisitResBean> getOrderVisitList(OrderResBean orderResBean);

	/**
	 * @param orderReqBean
	 * @return 联系记录总数
	 */
	public int countVisitNumByOrderId(String id);

	/**
	 * @param id
	 * @return List<OrderPaySerialResBean>
	 */
	public List<OrderPaySerialResBean> getOrderPaySerial(OrderResBean orderResBean);

	/**
	 * @param id
	 * @return 支付流水总数
	 */
	public int countPaySerialNumByOrderId(String id);

	/**
	 * 完成订单
	 * 
	 * @param orders
	 * @return 1-成功 2-失败
	 */
	public int complete(Orders orders);

	/**
	 * 查询该时间段下的团队订单
	 * @param groupOdersReqBean
	 * @return
	 */
	public List<Orders> queryGroupSalesPerformance(GroupOdersReqBean groupOdersReqBean);
	/**
	 * 获取机构下产品简称代码列表
	 * @param orgId
	 * @param productKey
	 * @return
	 */
	public List<ProductBreifBean> getOrgProductList(String orgId, String productKey, Integer type);
	
	/**
	 * 增加线下订单
	 * @return 1-成功，2-失败
	 * @throws IOException 
	 */
	public JsonBean addOfflineOrder(OfflineOrderReqBean model,MultipartFile paySignUser, MultipartFile idcardFront, MultipartFile idcardBack, MultipartFile bankCard) throws IOException;
	/**
	 * 获取机构下所有理财师
	 * @param String id
	 * @return List<GroupBean>
	 */
	List<EmpBreifBean> getOrgEmployeeList(String tenantIdentifier,String employeeKey);
	/**
	 * 获取产品理财师业绩统计
	 * @author yuqb
	 * @param productEmpStatsReqBean
	 * @return
	 */
	public List<ProductEmpStatsResBean> getProductEmpStats(ProductEmpStatsReqBean productEmpStatsReqBean);
//	/**
//	 * 获取产品理财师业绩统计条数
//	 * @author yuqb
//	 * @param productEmpStatsReqBean
//	 * @return
//	 */
//	public long countProductEmpStats(ProductEmpStatsReqBean productEmpStatsReqBean);
	/**
	 * 获取所有未募集完成产品的募集进度
	 * @author yuqb
	 * @param productEmpStatsReqBean
	 * @return
	 */
	public List<ProductRecruitProgressEleBean> getUncompletedProductRecruitProgress(ProductEmpStatsReqBean productEmpStatsReqBean);
	double saleAmount(IndexStatsReqBean indexStatsReqBean);
	/**
	 * 获得审核订单列表
	 * 
	 * @return
	 */
	public List<OrderResBean> getAuditOrderList(OrderReqBean orderReqBean);
	/**
	 * @param orderReqBean
	 * @return 记录总数
	 */
	public long countAuditOrderByOrgId(OrderReqBean orderReqBean);
	/**
	 * 定时任务:订单状态改变：即将到期：为基金成立时间+投资期限-前七日内的订单。待兑付状态为基金成立时间+投资期限>当前时间。
	 * 每一天执行一次
	 */
	public void ordersStateModifyTask();
	
	/**
	 * 获得审核订单列表
	 * 
	 * @return
	 */
	public List<OrderStateResBean> getOrderStateList(Orders o);
	
	public Integer updateOrderListState(List<OrderStateResBean> newOrderList);

	public List<OfflineApplyResBean> fetchOfflineApplyResBean(String id);
	
	public List<OrderOfflineApplyResBean> fetchOrderOfflineApplyResBean(String id);

	public List<OrderResBean> getRiskResBeanList(OrderReqBean model);

	public long countRiskByOrgId(OrderReqBean model);

	public List<IssuersOrdersResBean> getIssuersOrdersResBeanList(OrderReqBean model);
	public long getIssuersOrdersCount(OrderReqBean model);
	int sendRevisit(Orders model);
}
